import { createApp, createVNode } from "vue";
import { store, key } from "./utils/store";
import router from "./router";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import locale from "element-plus/lib/locale/lang/zh-cn";

import { Edit, Plus } from "@element-plus/icons";
import * as Icons from "@element-plus/icons";
import icoSvg from "./assets/icons/index.vue";
import App from "./App.vue";

const app = createApp(App);
app.use(store, key);
app.use(router);
app.use(ElementPlus, { locale });

// app.component("ico-edit", Edit);
// app.component("ico-plus", Plus);
// 创建Icon组件
const icoAuto = (props: { icon: string; size: number; color: string }) => {
  const { icon, size, color } = props;
  return createVNode(Icons[icon as keyof typeof Icons], {
    width: size,
    height: size,
    color: color,
  });
};
// 注册Icon组件
app.component("ico-auto", icoAuto);
app.component("ico-svg", icoSvg);
app.mount("#app");
